package cn.jhz.learn.blog.vo.article.submit;


import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Optional;

@Setter
@Getter
@ToString
public class SubfieldParam {

    @Length(min = 128, max = 129, message = "无效图片!")
    private String imgUrl;

    @Min(value = 1,message = "无效id!")
    private Integer id;

    @Length(min = 1, max = 256, message = "备注长度无效!")
    private String remark;

    @NotBlank(message = "无效标题!")
    @Length(min = 1, max = 16, message = "标题长度无效!")
    private String title;

    @NotNull(message = "公开属性为null!")
    @Min(value = 0, message = "公开属性无效!")
    @Max(value = 2, message = "公开属性无效!")
    private Byte visibility;

    public Optional<Integer> getId() {
        return Optional.ofNullable(this.id);
    }

    public Optional<String> getImgUrl() {
        return Optional.ofNullable(this.imgUrl);
    }
}
